package custom;

import android.content.Context;
import android.graphics.Paint;
import android.media.Image;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.qianfeng.lingshijia.R;

import utils.DownloadUtils;

/**
 * Created by yerj on 2016/1/13.
 */
public class GuessView extends LinearLayout{

    private ImageView ivGuess;
    private TextView tvTitle,tvPriceStr,tvOriginalPriceStr;

    public GuessView(Context context) {
        super(context);
        init();
    }

    public GuessView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    private void init() {
        LayoutInflater.from(getContext()).inflate(R.layout.detail_gusee_item,this);
        ivGuess = (ImageView) findViewById(R.id.id_iv_guess);
        tvTitle = (TextView) findViewById(R.id.id_title_guess);
        tvPriceStr = (TextView) findViewById(R.id.id_tv_priceStr);
        tvOriginalPriceStr = (TextView) findViewById(R.id.id_tv_originalPriceStr);
        tvOriginalPriceStr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
    }

    public void setData(String imgUrl,String title,String priceStr,String originalPriceStr){

        DownloadUtils.LoadPicture(imgUrl, ivGuess);
        tvTitle.setText(title);
        tvPriceStr.setText(priceStr);
        tvOriginalPriceStr.setText(originalPriceStr);

    }

}
